﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="验证注册页面.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div style="margin: 0 auto">
            <%--姓名：必填，且不能为admin

                密码：必填

                再次输入密码：必须一致

                年龄：0~100

                出生日期：格式正确，范围1900-01-01到2021-07-01

                毕业时间：格式正确，不能早于出生日期

                邮箱：格式正确

                提交

                错误汇总：单段，弹框。--%>
            <h1>注册页面</h1>
            姓名：
            <asp:TextBox ID="Name" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="NameHasV" runat="server" ErrorMessage="账号不能为空" ControlToValidate="Name" Display="Dynamic" ValidationGroup="register"></asp:RequiredFieldValidator>
            <br />

            密码:
            <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="PasswordV" runat="server" ErrorMessage="密码不能为空" Display="Dynamic" ValidationGroup="register" ControlToValidate="Password"></asp:RequiredFieldValidator>
            <br />

            重复密码：<asp:TextBox ID="RepeatPassword" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RepeatPasswordV" runat="server" ControlToValidate="RepeatPassword" ErrorMessage="密码不能为空" Display="Dynamic" ValidationGroup="register"></asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareRepeatPasswordV" runat="server" ErrorMessage="重复密码不正确" Display="Dynamic" ControlToValidate="RepeatPassword" ControlToCompare="Password" ValidationGroup="register"></asp:CompareValidator>
            <br />
            年龄：
            <asp:TextBox ID="Age" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="AgeHasV" runat="server" ErrorMessage="年龄超出范围" MinimumValue="0" MaximumValue="200" Type="Integer" ControlToValidate="Age" ValidationGroup="register"></asp:RangeValidator>
            <br />

            出生日期：<asp:TextBox ID="Birth" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="BirthRange" runat="server" ErrorMessage="超出时间范围" ControlToValidate="Birth" MinimumValue="2000-01-01" Type="Date"></asp:RangeValidator>
            <asp:RegularExpressionValidator ID="RegularBirth" runat="server" ErrorMessage="格式出错" ValidationExpression="^\d{4}-\d{2}-\d{2}$" ControlToValidate="Birth"></asp:RegularExpressionValidator>
            <br />

            毕业日期：<asp:TextBox ID="Graduate" runat="server"></asp:TextBox>
            <asp:CompareValidator ID="CompareGraduate" runat="server" ErrorMessage="毕业时间不能大于出生时间" ControlToValidate="Graduate" ControlToCompare="Birth" Operator="GreaterThanEqual"></asp:CompareValidator>
            <br />
            邮箱：
            <asp:TextBox ID="Mail" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ControlToValidate="Mail" ID="RegularExpressionValidator1" runat="server" ErrorMessage="格式出错" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="register"></asp:RegularExpressionValidator>
            <br />

            <br />
            <asp:Button ID="Button1" runat="server" Text="提交" ValidationGroup="register" OnClick="Button1_Click" />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="register" DisplayMode="SingleParagraph" ShowMessageBox="True" />
            <asp:Literal ID="Success" runat="server"></asp:Literal>
            <br />
            
        </div>


    </form>
</body>
</html>
